function [ Avg, First, Last ] = evaluate( ranking, LOES, LOFS, NumOfEntities )
%RANKING Summary of this function goes here
%   Detailed explanation goes here
    First = NumOfEntities;
    Avg = 0;
    Last = 0;
    
    newLOFS = LOFS;
    for n = 1:size(LOFS,1)
        newLOFS(n) = find(LOES==LOFS(n));
    end
    for n = 1:size(ranking,2)
        ranking(n) = ranking(n) + rand(1) / 10000000;
    end
    
    [~,index] = sort(ranking,'descend');

    for n = 1:length(newLOFS)
        ranking = find(index==newLOFS(n));
        Avg = Avg + ranking;
        if ranking > Last
            Last = ranking;
        end
        if ranking < First
            First = ranking;
        end
    end
    
    Avg = Avg / size(LOFS,1);
    Avg = Avg / NumOfEntities * 100;
    First = First / NumOfEntities * 100;
    Last = Last / NumOfEntities * 100;

end

